#!/usr/bin/env bash 
 
echo "start install python3" 
 
mkdir /usr/local/python3
cd /usr/local/python3
echo "创建usr/local/python3文件夹成功" 

echo "下载jdk 成功，开始进入解压..."
tar -zxvf /home/downloads/Python-3.7.4.tgz -C /home/downloads/
echo "解压成功"

echo "开始编译..."
cd /home/downloads/Python-3.7.4
./configure --prefix=/usr/local/python3 --enable-optimizations
make && make install
echo "编译成功..."

echo "删除已解压缩文件"
rm -rf /home/downloads/Python-3.7.4

echo "添加软连接,修改为默认版本"
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
 
echo "python3 安装成功"
echo "开始测试python3是否安装看成。看下面输出:"
python3